Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

222
Visualizações
"You may need an appropriate loader to handle this file type" error ReactJS while trying to access data from Rapid API

I'm trying to access total key from data.stats object from Cryptoranking RapidApi but it throw this error:

./src/components/Homepage.jsx 17:25

Module parse failed: Unexpected token (17:25) You may need an appropriate loader to handle this file type. isFetching = _useGetCryptosQuery.isFetching;

var globalStats = data?.data?.stats;

if (isFetching) return /#PURE/React.createElement(Loader, { __self: _this,

I've tried everything I knew so far to resolve this (object destructuring, reinstall react, update babel ), but nothing works.

Here are Homepage.jsx file:

import React from 'react'
import millify from 'millify';
import { Typography, Row, Col, Statistic } from 'antd';
import { Link } from 'react-router-dom';
import { useGetCryptosQuery } from '../services/cryptoApi';
import Loader from './Loader'; 

const { Title } = Typography; 

const Homepage = () => {
  const { data, isFetching } = useGetCryptosQuery();
  const globalStats = data?.data?.stats;

  if(isFetching) return <Loader />;

  console.log(data);
  console.log(globalStats);

  return (
    <>
      <Title level={2} className='heading'>Global Crypto Stats</Title>
      <Row>
        <Col span={12}> <Statistic title='Total Cryptocurrencies' value={globalStats.total}/></Col>
        <Col span={12}> <Statistic title='Total Exchanges' value='4'/></Col>
        <Col span={12}> <Statistic title='Total Market Cap' value='5'/></Col>
        <Col span={12}> <Statistic title='Total 24h Volume' value='5'/></Col>
        <Col span={12}> <Statistic title='Total Markets' value='5'/></Col>
      </Row>
    </>
  )
}

export default Homepage;

If I console.log(data) the API data is logged perfectly fine. But I still cannot access data.stats.total.

Console.log result image

Any ideas? Thanks!

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda